package com.cjy.common.utils.tag;

import java.io.Writer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Anchor;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * 自定义A标签Bean User: jay.zhoujingjie Date: 13-12-20 Time: 下午3:02
 */
public class ATagBean extends Anchor {
	// 是否可见
	private boolean visible;

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public ATagBean(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	/**
	 * Overrides to be able to render body in a template rather than always
	 * before the template
	 */
	@Override
	public boolean end(Writer writer, String body) {
		if (visible) {
			return super.end(writer, body);
		} else {
			return false;
		}
	}
}
